package com.kingsystem.kingteachermarks_backend.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kingsystem.kingteachermarks_backend.entity.WorkPerformanceFiles;
import com.kingsystem.kingteachermarks_backend.mapper.WorkPerformanceFilesMapper;
import com.kingsystem.kingteachermarks_backend.service.impl.WorkPerformanceFilesServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author leiyue_yao
 * @since 2025-07-31
 */
@Controller
@RequestMapping("/workPerformanceFiles")
@CrossOrigin
public class WorkPerformanceFilesController {

    @Autowired
    private WorkPerformanceFilesMapper wpm;

    @Autowired
    private WorkPerformanceFilesServiceImpl wpi;

    @PostMapping("getFilesById")
    @ResponseBody
    public List<WorkPerformanceFiles> getFilesById(@RequestParam("workPerformanceId") String workPerformanceId){
        List<WorkPerformanceFiles> li = new ArrayList<>();
        QueryWrapper<WorkPerformanceFiles> qw = new QueryWrapper<>();
        qw.eq("work_performance_id", workPerformanceId);

        li = wpi.list(qw);
        return li;
    }
}
